using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Volo.Abp.Domain.Entities;

namespace ERP.ERPModels.WarehouseManagement
{
    /// <summary>
    /// 库存交易记录模型
    /// </summary>
    public class InventoryTransaction : Entity<int>
    {
        /// <summary>
        /// 交易日期
        /// </summary>
        [Required]
        public DateTime TransactionDate { get; set; }

        /// <summary>
        /// 交易类型（1:入库, 2:出库）
        /// </summary>
        [Required]
        public int TransactionType { get; set; }

        /// <summary>
        /// 物料ID
        /// </summary>
        [Required]
        public int MaterialId { get; set; }

        /// <summary>
        /// 物料编码
        /// </summary>
        [Required]
        [StringLength(50)]
        public string MaterialCode { get; set; }

        /// <summary>
        /// 物料名称
        /// </summary>
        [Required]
        [StringLength(100)]
        public string MaterialName { get; set; }

        /// <summary>
        /// 物料分类ID
        /// </summary>
        public int? MaterialClassId { get; set; }

        /// <summary>
        /// 物料分类名称
        /// </summary>
        [StringLength(100)]
        public string MaterialClassName { get; set; }

        /// <summary>
        /// 仓库ID
        /// </summary>
        [Required]
        public int WarehouseId { get; set; }

        /// <summary>
        /// 仓库名称
        /// </summary>
        [Required]
        [StringLength(100)]
        public string WarehouseName { get; set; }

        /// <summary>
        /// 交易数量
        /// </summary>
        [Required]
        public decimal Quantity { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        [StringLength(20)]
        public string Unit { get; set; }

        /// <summary>
        /// 源单据类型（1:采购订单, 2:生产工单, 3:销售订单等）
        /// </summary>
        public int? SourceDocumentType { get; set; }

        /// <summary>
        /// 源单据ID
        /// </summary>
        public int? SourceDocumentId { get; set; }

        /// <summary>
        /// 源单据编号
        /// </summary>
        [StringLength(50)]
        public string SourceDocumentCode { get; set; }

        /// <summary>
        /// 创建人ID
        /// </summary>
        public int? CreatedBy { get; set; }

        /// <summary>
        /// 创建人名称
        /// </summary>
        [StringLength(50)]
        public string CreatedByName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500)]
        public string Remark { get; set; }
    }
} 